package com.huawei.appmarket.framework.widget;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import com.huawei.appgallery.foundation.ui.framework.widget.BottomButton;
import o.dky.a;
import o.epo;

public class RenderButton extends BottomButton implements RenderListener {
    public RenderButton(Context context) {
        super(context);
    }

    public RenderButton(Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public RenderButton(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        CSSRule rule = cSSViewProxy.getRule();
        View view = cSSViewProxy.getView();
        if (rule.getStyleDeclaration() != null) {
            CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.FONT_COLOR);
            if (propertyValue != null && (propertyValue instanceof CSSMonoColor)) {
                CSSMonoColor cSSMonoColor = (CSSMonoColor) propertyValue;
                Drawable drawable = view.getContext().getResources().getDrawable(a.ˏ);
                int color = cSSMonoColor.getColor();
                setTextColor(color);
                Drawable ॱ = epo.ॱ(drawable, color);
                ॱ.setAlpha(38);
                setBackground(ॱ);
            }
        }
        return false;
    }
}
